import axios from 'axios'
import apiUrls from 'common/api-urls'
import { contentTypeWww } from 'common/axio-decorate'

export function getCourse(data) {
  return axios.get(apiUrls.getCourse, {
    params: data
  })
}

export function addCourse(data) {
  return axios.post(apiUrls.addCourse, {
    ...data
  })
}

export function delCourse(data) {
  data = JSON.parse(JSON.stringify(data))
  return axios.post(`${apiUrls.delCourse}/${data.id}`, data, {
    headers: { 'Content-Type': contentTypeWww }
  })
}

export function addCustomer(data) {
  return axios.post(apiUrls.addCustomer, {
    ...data
  })
}

export function updateCustomer(data) {
  return axios.post(apiUrls.updateCustomer, {
    ...data
  })
}

export function getCustomerById(data) {
  data = JSON.parse(JSON.stringify(data))
  return axios.get(`${apiUrls.getCustomerById}/${data.id}`, {
    params: data
  }, {
    headers: { 'Content-Type': contentTypeWww }
  })
}

export function getCustomerProjectList(data) {
  return axios.get(apiUrls.getCustomerProjectList, {
    params: data
  })
}
